package com.sphd.beautysalon.presenter;


import com.android.volley.VolleyError;
import com.sphd.beautysalon.info.ConsumeInfo;
import com.sphd.beautysalon.model.VipMationModelImpl;
import com.sphd.beautysalon.view.VipMationView;

import java.util.List;

/**
 * Created by Hu on 2016/11/10
 */

public class VipMationPresenterImpl implements VipMationPresenter {

    VipMationModelImpl vipMationModel;
    VipMationView vipMationView;

    public VipMationPresenterImpl(VipMationView vipMationView) {
        this.vipMationView = vipMationView;
        vipMationModel=new VipMationModelImpl();
    }

    @Override
    public void addData(String url) {
        vipMationView.showLoading();
        vipMationModel.setUrl(url,this);
    }

    @Override
    public void sendError(VolleyError error) {
        vipMationView.dissLoading();
    }

    @Override
    public void sendRes(double account, int cards, int integral, List<ConsumeInfo> consumeInfos) {
        vipMationView.recRes(account,cards,integral,consumeInfos);
        vipMationView.dissLoading();
    }

    @Override
    public void sendEdit(String s) {
        vipMationView.showLoading();
        vipMationModel.sendEditUrl(s,this);
    }

    @Override
    public void sendEditRes(int res) {
        vipMationView.recEditRes(res);
        vipMationView.dissLoading();
    }
}